cmake_minimum_required(VERSION 3.0.2)
project(object_cluster_voxelGrid)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3")
set(CMAKE_CXX_STANDARD 17)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
        roscpp
        pcl_ros
        pcl_conversions
        tf
        eigen_conversions
        cv_bridge#可以将sensor/Image 和OpenCV关联起来
        sensor_msgs
        image_transport
        nav_msgs
        message_generation
        std_msgs
        message_runtime
        msgs
)
#add_message_files(
#        FILES
#        Bbox.msg
#        BboxList.msg
#)
#
generate_messages(
        DEPENDENCIES
        std_msgs
)


#catkin_package(
#        CATKIN_DEPENDS geometry_msgs nav_msgs roscpp rospy std_msgs message_runtime
#        DEPENDS EIGEN3 PCL
#        INCLUDE_DIRS
#)

find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})

find_package(PCL REQUIRED QUIET)
find_package(OpenCV REQUIRED QUIET)
include(cmake/glog.cmake)

#catkin_package(
#        INCLUDE_DIRS include
#        #  LIBRARIES Obstacle-Cluster
#          CATKIN_DEPENDS roscpp message_runtime
##          DEPENDS msgs
#)

include_directories(
        include
        ${catkin_INCLUDE_DIRS}
        ${PCL_INCLUDE_DIRS}
        ${OpenCV_INCLUDE_DIRS}
)

link_directories(
        include
        ${OpenCV_LIBRARY_DIRS}
        ${PCL_LIBRARY_DIRS}
)

file(GLOB_RECURSE ALL_SRC "src/*.cc")
file(GLOB_RECURSE ALL_SRC_CPP "src/*.cpp")


add_executable(ObjectSegVoxelGrid node/ObjectSeg_VoxelGrid.cc ${ALL_SRC} ${ALL_SRC_CPP})
add_dependencies(ObjectSegVoxelGrid ${catkin_EXPORTED_TARGETS})
target_link_libraries(ObjectSegVoxelGrid ${catkin_LIBRARIES} ${ALL_TARGET_LIBRARIES} ${PCL_LIBRARIES} ${GLOG_LIBRARIES})
#
add_executable(ObjectSegVoxelGrid3Dto2D node/ObjectSeg_VoxelGrid_3Dto2D.cc ${ALL_SRC} ${ALL_SRC_CPP})
add_dependencies(ObjectSegVoxelGrid3Dto2D ${catkin_EXPORTED_TARGETS})
target_link_libraries(ObjectSegVoxelGrid3Dto2D ${catkin_LIBRARIES} ${ALL_TARGET_LIBRARIES} ${PCL_LIBRARIES} ${GLOG_LIBRARIES} ${OpenCV_LIBRARIES})

add_executable(bboxmerge node/bbox_merge.cc ${ALL_SRC} ${ALL_SRC_CPP})
add_dependencies(bboxmerge ${catkin_EXPORTED_TARGETS} object_cluster_voxelGrid_generate_messages_cpp)
#add_dependencies(bboxmerge )
target_link_libraries(bboxmerge ${catkin_LIBRARIES} ${ALL_TARGET_LIBRARIES} ${PCL_LIBRARIES} ${GLOG_LIBRARIES} ${OpenCV_LIBRARIES})

#target_include_directories(Bbboxmerge PRIVATE ${PYTHON_INCLUDE_DIRS})
#add_executable(ObjectSegVoxelGrid node/ObjectSeg_VoxelGrid.cc ${ALL_SRC} ${ALL_SRC_CPP})
#add_dependencies(ObjectSegVoxelGrid ${catkin_EXPORTED_TARGETS})
#target_link_libraries(ObjectSegVoxelGrid ${catkin_LIBRARIES} ${ALL_TARGET_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES} ${GLOG_LIBRARIES})


